Feature: Census Page - Zip Code Out Of Aera Validation

  # Author: Maria Chen
  # Execution&Update History
  # |Date          |Owner        |Update/Execution Remark        |Comments                          |
  # |4/13/2016    |Maria Chen   |First Draft                    |
  ##################################zip code out of aera############################################
  @happy
  Scenario: Carrier sell products in the aera - System should return success message
    When I send a GET request to "census/census-condition?allianceId=Gro21010&zipCode=98001&productLine=ifp&county=KING"
    Then the response status should be 200
    And the ifpSep should be correct
    And the JSON response should be
      """
      {
      "maxPrimaryAge": 130,
      "minPrimaryAge": 0,
      "maxSpouseAge": 130,
      "minSpouseAge": 14,
      "maxChildAge": 26,
      "ifpSep": "${json-unit.ignore}",
      "conditionForFamilyType": {},
      "states": [
      {
      "state": "Washington",
      "stateAbbr": "WA",
      "county": "KING"
      }
      ],
      "counties": [
      "KING"
      ]
      }
      """

  @happy
  Scenario: Carrier sell products in the aera - System should return success message
    When I send a GET request to "census/census-condition?allianceId=Gro21010&zipCode=98001&productLine=MA&county=KING"
    Then the response status should be 200
    And the ifpSep should be correct
    And the JSON response should be
      """
      {
      "maxPrimaryAge": 130,
      "minPrimaryAge": 0,
      "maxSpouseAge": 130,
      "minSpouseAge": 14,
      "maxChildAge": 26,
      "ifpSep": "${json-unit.ignore}",
      "conditionForFamilyType": {},
      "states": [
      {
      "state": "Washington",
      "stateAbbr": "WA",
      "county": "KING"
      }
      ],
      "counties": [
      "KING"
      ]
      }
      """

  @happy
  Scenario: Carrier sell products in the aera - System should return success message
    When I send a GET request to "census/census-condition?allianceId=Pac26719&zipCode=97001&productLine=dt&county=WASCO"
    Then the response status should be 200
    And the ifpSep should be correct
    And the JSON response should be
      """
      {
      "maxPrimaryAge": 130,
      "minPrimaryAge": 0,
      "maxSpouseAge": 130,
      "minSpouseAge": 14,
      "maxChildAge": 26,
      "ifpSep": "${json-unit.ignore}",
      "conditionForFamilyType": {},
      "states": [
      {
      "state": "Oregon",
      "stateAbbr": "OR",
      "county": "WASCO"
      }
      ],
      "counties": [
      "WASCO"
      ]
      }
      """

  @sad
  Scenario: System doesn't sell products in the ZIP - System should return error message
    When I send a GET request to "census/census-condition?allianceId=Gro21010&zipCode=97001&productLine=IFP&county=WASCO"
    Then the response status should be 406
    And the error type should be "NOT_ACCEPTABLE"
    And the error message should be "Zip code out of area"

  @sad
  Scenario: County incorrect - System return error message
    When I send a GET request to "census/census-condition?allianceId=Gro21010&zipCode=98001&productLine=IFP&county=WASCO"
    Then the response status should be 406
    And the error type should be "NOT_ACCEPTABLE"
    And the error message should be "Zip code out of area"

  @sad
  Scenario: County empty - System return error message
    When I send a GET request to "census/census-condition?allianceId=Gro21010&zipCode=98001&productLine=IFP&county="
    Then the response status should be 406
    And the error type should be "NOT_ACCEPTABLE"
    And the error message should be "Zip code out of area"

  @sad
  Scenario: Alliance Invalid - System return error message
    When I send a GET request to "census/census-condition?allianceId=reg31863&zipCode=98001&productLine=IFP&county=KING"
    Then the response status should be 406
    And the error type should be "NOT_ACCEPTABLE"
    And the error message should be "Zip code out of area"

  @sad
  Scenario: Carrier doesn't sell product line products - System return error message
    When I send a GET request to "census/census-condition?allianceId=Gro21010&zipCode=98001&productLine=DT&county=KING"
    Then the response status should be 406
    And the error type should be "NOT_ACCEPTABLE"
    And the error message should be "Zip code out of area"
